Mega Code Archive
Math
1) Abs( ) function returns the absolute value of the parameter
2) BCMath Functions
3) Both random generators provide functions to get the value of MAX_RAND
4) Calculate logarithms by dividing log() function with log(base)
5) Calculate logarithms with other base values by dividing the result of the log() function with log(base)
6) Calculation of e, the inverse nature of exp and log
7) Calling the Built-in abs() Function
8) Constants and switch statement
9) Constants, like the names of variables, are case-sensitivebut unlike variables
10) Convert integer values to other bases such as binary or base 32 and base 36
11) Create and use a simple static Math() class
12) Define a constant as an array or object
13) Dice Rolling Simulator
14) Difference between ceil and floor
15) Doing math with the bcmath extension
16) Doubles can be specified in scientific notation
17) Finding a random line of a file
18) Finding the Greatest and Least Values in a key-value pair
19) Finding the Greatest and Least Values in an Array
20) Float acos ( float num ) calculates the arc cosine value
21) Float asin ( float num ) calculates the arc sine value
22) Float atan ( float num ) calculates the arc tangent value
23) Float ceil ( float num ) rounds parameter to the nearest integer above its current value
24) Float cos ( float num ) calculates the cosine value of the number provided as its only parameter The parameter should be passed as ra
25) Float deg2rad ( float num ) converts degrees to radians
26) Float floor ( float num ) rounds it to the nearest integer below its current value
27) Float rad2deg ( float num ) converts radians to degrees
28) Float round ( float num [, int precision] ) rounds parameter to the nearest integer to its current value
29) Float sin ( float num ) calculates the sine value of the number provided as its only parameter
30) Float tan ( float num ) calculates the tangent value of the number
31) Floor in action
32) Function base_convert() converts any integer value from one base to another
33) Generate Password()
34) Generate random floating-point values from 0 to 10 with two decimals
35) Generate random numbers
36) Generate random numbers (integer values) between 0 and MAX_RAND by calling rand() or mt_rand() without any arguments
37) Get a random value from 5 to 25
38) Get random values from 10 to 10
39) Get the Power
40) Hyperbolic Functions
41) Int mt_rand ( [int min, int max] ) returns random numbers, similar to the rand( )
42) Int rand ( [int min, int max] ) returns random numbers
43) Math calculation
44) Math operations
45) Mathematical constants
46) Mt_rand with no arguments
47) Mt_rand with two arguments
48) Number decbin ( string binary_num ) converts a binary number into a decimal number
49) Number hexdec ( string hex_string ) converts a hexadecimal number into a decimal number
50) Number pow ( number base, number exponent), a base and a power to raise it by
51) Provide the number of decimal places to round to
52) Rand demo
53) Random floating-point values from 0 to 10 with two decimals
54) Random generators provide functions to get the value of MAX_RAND
55) Random Images
56) Random numbe with precision
57) Random Numbers
58) Random values are not restricted to positive integers The following example shows how to get random values from -10 to 10
59) Return the distance between two locations in either kilometers or miles
60) Round a double
61) Round in action
62) String base_convert ( string num, int from_base, int to_base ) convert every base to every other base
63) String decbin ( int num ) converts a decimal number into a binary number
64) String dechex ( int num ) converts a decimal number into a binary number
65) String decoct ( int num ) converts a decimal number into an octal number
66) Using the arbitrary-precision functions for exact integer arithmetic
67) Using the pow() function with integers, floats, and both negative and positive numbers
68) Using the trigonometric functions
69) You can either send a floating-point number or an integer to abs( )